﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NumericalMatrix.Interfaces;
using NumericalMatrix.Exceptions;
using NumericalMatrix.Services;

namespace NumericalMatrix
{
    internal static class MatrixExtensions
    {
        //static public IMatrix<double> LinSolveLtriang(this IMatrix<double> a, IMatrix<double> b)
        //{
        //    Matrix2 x = new Matrix2(a.Height, 1);

        //    if (b.Width == 1 && a.Height == b.Height)
        //    {
        //        for (int i = 0; i < a.Height; i++)
        //        {
        //            double sum = 0;
        //            for (int j = 0; j < i; j++)
        //                sum += a[i, j] * x[j, 0];

        //            x[i, 0] = (b[i, 0] - sum) / a[i, i];
        //        }

        //        return x;
        //    }
        //    throw new MatrixException("Wrong input parameters: column count of input matrix must be equal to one. Row count of matrices must be equal.");
        //}

        //static public IMatrix<double> LinSolveRtriang(this IMatrix<double> a, IMatrix<double> b)
        //{
        //    Matrix2 x = new Matrix2(a.Height, 1);

        //    if (b.Width == 1 && a.Height == b.Height)
        //    {
        //        for (int i = a.Height - 1; i >= 0; i--)
        //        {
        //            double sum = 0;
        //            for (int j = i + 1; j < a.Width; j++)
        //                sum += a[i, j] * x[j, 0];

        //            x[i, 0] = (b[i, 0] - sum) / a[i, i];
        //        }

        //        return x;
        //    }
        //    throw new MatrixException("Wrong input parameters: column count of input matrix must be equal to one. Row count of matrices must be equal.");
        //}
    }
}
